include $(RT28xx_DIR)/os/linux/config.mk

#ifdef CONFIG_AP_SUPPORT
ifeq ($(RT28xx_MODE),AP)
MOD_NAME = mt$(MODULE)ap
DAT_PATH = /etc/Wireless/RT$(MODULE_DAT)AP
DAT_FILE_NAME = RT$(MODULE_DAT)AP.dat
endif
#endif // CONFIG_AP_SUPPORT //

#ifdef CONFIG_STA_SUPPORT
ifeq ($(RT28xx_MODE), STA)
MOD_NAME = mt$(MODULE)sta
DAT_PATH = /etc/Wireless/RT$(MODULE_DAT)STA
DAT_FILE_NAME = RT$(MODULE_DAT)STA.dat
endif
#endif // CONFIG_STA_SUPPORT //

#ifdef CONFIG_APSTA_SUPPORT
ifeq ($(RT28xx_MODE), APSTA)
MOD_NAME = mt$(MODULE)apsta
endif
#endif // CONFIG_APSTA_SUPPORT //

#ifdef WAPI_SUPPORT
ifeq ($(HAS_WAPI_SUPPORT),y)
OBJ := -DEXPORT_SYMTAB
endif
#endif // WAPI_SUPPORT //

OBJ := $(MOD_NAME).o

#ifdef CONFIG_AP_SUPPORT
RT28XX_AP_OBJ := \
	$(RT28xx_DIR)/common/crypt_md5.o\
	$(RT28xx_DIR)/common/crypt_sha2.o\
	$(RT28xx_DIR)/common/crypt_hmac.o\
	$(RT28xx_DIR)/common/crypt_aes.o\
	$(RT28xx_DIR)/common/crypt_arc4.o\
	$(RT28xx_DIR)/common/mlme.o\
	$(RT28xx_DIR)/common/cmm_wep.o\
	$(RT28xx_DIR)/common/action.o\
	$(RT28xx_DIR)/common/cmm_data.o\
	$(RT28xx_DIR)/common/rtmp_init.o\
	$(RT28xx_DIR)/common/rtmp_init_inf.o\
	$(RT28xx_DIR)/common/cmm_tkip.o\
	$(RT28xx_DIR)/common/cmm_aes.o\
	$(RT28xx_DIR)/common/cmm_sync.o\
	$(RT28xx_DIR)/common/eeprom.o\
	$(RT28xx_DIR)/common/cmm_sanity.o\
	$(RT28xx_DIR)/common/cmm_info.o\
	$(RT28xx_DIR)/common/cmm_cfg.o\
	$(RT28xx_DIR)/common/cmm_wpa.o\
	$(RT28xx_DIR)/common/dfs.o\
	$(RT28xx_DIR)/common/spectrum.o\
	$(RT28xx_DIR)/common/rtmp_timer.o\
	$(RT28xx_DIR)/common/rt_channel.o\
	$(RT28xx_DIR)/common/cmm_profile.o\
	$(RT28xx_DIR)/common/cmm_asic.o\
	$(RT28xx_DIR)/common/cmm_cmd.o\
	$(RT28xx_DIR)/rate_ctrl/ra_ctrl.o\
	$(RT28xx_DIR)/rate_ctrl/alg_legacy.o\
	$(RT28xx_DIR)/os/linux/rt_profile.o\
	$(RT28xx_DIR)/ap/ap_mbss.o\
	$(RT28xx_DIR)/chips/rtmp_chip.o\
	$(RT28xx_DIR)/ap/ap.o\
	$(RT28xx_DIR)/ap/ap_assoc.o\
	$(RT28xx_DIR)/ap/ap_auth.o\
	$(RT28xx_DIR)/ap/ap_connect.o\
	$(RT28xx_DIR)/ap/ap_mlme.o\
	$(RT28xx_DIR)/ap/ap_sanity.o\
	$(RT28xx_DIR)/ap/ap_sync.o\
	$(RT28xx_DIR)/ap/ap_wpa.o\
	$(RT28xx_DIR)/ap/ap_data.o\
	$(RT28xx_DIR)/common/uapsd.o\
	$(RT28xx_DIR)/ap/ap_autoChSel.o\
	$(RT28xx_DIR)/ap/ap_qload.o\
	$(RT28xx_DIR)/ap/ap_cfg.o

ifeq ($(OSABL),NO)
RT28XX_AP_OBJ := \
	$(RT28xx_DIR)/ap/ap_mbss_inf.o\
	$(RT28xx_DIR)/common/rt_os_util.o\
	$(RT28xx_DIR)/os/linux/ap_ioctl.o\
	$(RT28xx_DIR)/os/linux/rt_linux.o\
	$(RT28xx_DIR)/os/linux/rt_main_dev.o
else
RT28XX_AP_OBJ := \
	$(RT28xx_DIR)/os/linux/rt_symb.o
endif

ifeq ($(HAS_NEW_RATE_ADAPT_SUPPORT),y)
RT28XX_AP_OBJS += $(RT28xx_DIR)/rate_ctrl/alg_grp.o
endif

#ifdef DOT11_N_SUPPORT
ifeq ($(HAS_DOT11_N_SUPPORT),y)
RT28XX_AP_OBJ += \
	$(RT28xx_DIR)/common/ba_action.o\
	$(RT28xx_DIR)/mgmt/mgmt_ht.o

#ifdef TXBF_SUPPORT
ifeq ($(HAS_TXBF_SUPPORT),y)
rt$(MODULE)ap-objs += \
	$(RT28xx_DIR)/common/cmm_txbf.o\
	$(RT28xx_DIR)/common/cmm_txbf_cal.o
endif
#endif // TXBF_SUPPORT //
endif
#endif // DOT11_N_SUPPORT //

#ifdef BG_FT_SUPPORT
ifeq ($(OSABL),NO)
ifeq ($(HAS_BGFP_SUPPORT),y)
RT28XX_AP_OBJ += \
	$(RT28xx_DIR)/os/linux/br_ftph.o
endif
endif
#endif // BG_FT_SUPPORT //

#ifdef LED_CONTROL_SUPPORT
ifeq ($(HAS_LED_CONTROL_SUPPORT),y)
RT28XX_AP_OBJ += \
	$(RT28xx_DIR)/common/rt_led.o
endif
#endif // LED_CONTROL_SUPPORT //














ifeq ($(HAS_RT2880_RT2860_COEXIST),y)	
RT28XX_AP_OBJ += \
	$(RT28xx_DIR)/os/linux/rt_pci_rbus.o\
	$(RT28xx_DIR)/os/linux/rt_rbus_pci_util.o\
	$(RT28xx_DIR)/os/linux/pci_main_dev.o\
	$(RT28xx_DIR)/common/cmm_dfs.o
endif

ifeq ($(HAS_ATE),y)
RT28XX_AP_OBJ += $(RT28xx_DIR)/ate/common/rt_ate.o
endif

ifeq ($(HAS_QA_SUPPORT),y)
RT28XX_AP_OBJ += $(RT28xx_DIR)/ate/common/rt_qa.o
endif

#ifdef WSC_INCLUDED
ifeq ($(HAS_WSC),y)
RT28XX_AP_OBJ += \
	$(RT28xx_DIR)/common/wsc.o\
	$(RT28xx_DIR)/common/wsc_tlv.o\
	$(RT28xx_DIR)/common/wsc_ufd.o\
	$(RT28xx_DIR)/common/crypt_biginteger.o\
	$(RT28xx_DIR)/common/crypt_dh.o
endif
ifeq ($(HAS_WSC_V2),y)
RT28XX_AP_OBJ += $(RT28xx_DIR)/common/wsc_v2.o
endif
#endif // WSC_INCLUDED //



ifeq ($(HAS_WDS),y)
RT28XX_AP_OBJ += $(RT28xx_DIR)/ap/ap_wds.o

ifeq ($(OSABL),NO)
RT28XX_AP_OBJ += \
	../../ap/ap_wds_inf.o
endif
endif

#ifdef APCLI_SUPPORT
ifeq ($(HAS_APCLI),y)
RT28XX_AP_OBJ += \
	$(RT28xx_DIR)/ap/ap_apcli.o \
	$(RT28xx_DIR)/ap/apcli_ctrl.o \
	$(RT28xx_DIR)/ap/apcli_sync.o \
	$(RT28xx_DIR)/ap/apcli_auth.o \
	$(RT28xx_DIR)/ap/apcli_assoc.o \
	$(RT28xx_DIR)/common/cmm_mat.o \
	$(RT28xx_DIR)/common/cmm_mat_iparp.o \
	$(RT28xx_DIR)/common/cmm_mat_pppoe.o \
	$(RT28xx_DIR)/common/cmm_mat_ipv6.o

ifeq ($(OSABL),NO)
RT28XX_AP_OBJ += \
	../../ap/ap_apcli_inf.o
endif
endif
#endif // APCLI_SUPPORT //

ifeq ($(HAS_BLOCK_NET_IF),y)
RT28XX_AP_OBJ += $(RT28xx_DIR)/common/netif_block.o
endif

ifeq ($(HAS_IGMP_SNOOP_SUPPORT),y)
RT28XX_AP_OBJ += $(RT28xx_DIR)/common/igmp_snoop.o
endif


ifeq ($(HAS_QOS_DLS_SUPPORT),y)
RT28XX_AP_OBJ += $(RT28xx_DIR)/ap/ap_dls.o
endif

ifeq ($(HAS_IDS_SUPPORT),y)
RT28XX_AP_OBJ += $(RT28xx_DIR)/ap/ap_ids.o
endif

ifeq ($(PLATFORM),IKANOS_V160)
RT28XX_AP_OBJ += $(RT28xx_DIR)/os/linux/vr_ikans.o
endif

ifeq ($(PLATFORM),IKANOS_V180)
RT28XX_AP_OBJ += $(RT28xx_DIR)/os/linux/vr_ikans.o
endif


#ifdef WAPI_SUPPORT
ifeq ($(HAS_WAPI_SUPPORT),y)
RT28XX_AP_OBJ += \
	$(RT28xx_DIR)/common/wapi.o
endif
#endif // WAPI_SUPPORT //




ifeq ($(HAS_CLIENT_WDS_SUPPORT),y)
RT28XX_AP_OBJ += \
	$(RT28xx_DIR)/common/client_wds.o
endif
#endif // CONFIG_AP_SUPPORT //

#ifdef CONFIG_STA_SUPPORT
RT28XX_STA_OBJ := \
	$(RT28xx_DIR)/common/crypt_md5.o\
	$(RT28xx_DIR)/common/crypt_sha2.o\
	$(RT28xx_DIR)/common/crypt_hmac.o\
	$(RT28xx_DIR)/common/crypt_aes.o\
	$(RT28xx_DIR)/common/crypt_arc4.o\
	$(RT28xx_DIR)/common/mlme.o\
	$(RT28xx_DIR)/common/cmm_wep.o\
	$(RT28xx_DIR)/common/action.o\
	$(RT28xx_DIR)/common/cmm_data.o\
	$(RT28xx_DIR)/common/rtmp_init.o\
	$(RT28xx_DIR)/common/rtmp_init_inf.o\
	$(RT28xx_DIR)/common/cmm_tkip.o\
	$(RT28xx_DIR)/common/cmm_aes.o\
	$(RT28xx_DIR)/common/cmm_sync.o\
	$(RT28xx_DIR)/common/eeprom.o\
	$(RT28xx_DIR)/common/cmm_sanity.o\
	$(RT28xx_DIR)/common/cmm_info.o\
	$(RT28xx_DIR)/common/cmm_cfg.o\
	$(RT28xx_DIR)/common/cmm_wpa.o\
	$(RT28xx_DIR)/common/cmm_radar.o\
	$(RT28xx_DIR)/common/cmm_dfs.o\
	$(RT28xx_DIR)/common/spectrum.o\
	$(RT28xx_DIR)/common/rtmp_timer.o\
	$(RT28xx_DIR)/common/rt_channel.o\
	$(RT28xx_DIR)/common/cmm_profile.o\
	$(RT28xx_DIR)/common/cmm_asic.o\
	$(RT28xx_DIR)/common/scan.o\
	$(RT28xx_DIR)/common/ps.o\
	$(RT28xx_DIR)/common/cmm_cmd.o\
	$(RT28xx_DIR)/rate_ctrl/ra_ctrl.o\
	$(RT28xx_DIR)/rate_ctrl/alg_legacy.o\
	$(RT28xx_DIR)/rate_ctrl/alg_ags.o\
	$(RT28xx_DIR)/os/linux/rt_profile.o\
	$(RT28xx_DIR)/chips/rtmp_chip.o\
	$(RT28xx_DIR)/common/txpower.o\
	$(RT28xx_DIR)/mac/rtmp_mac.o\
	$(RT28xx_DIR)/mgmt/mgmt_hw.o\
	$(RT28xx_DIR)/mgmt/mgmt_entrytb.o\
	$(RT28xx_DIR)/phy/rtmp_phy.o\
	$(RT28xx_DIR)/phy/rlt_phy.o\
	$(RT28xx_DIR)/phy/rlt_rf.o\
	$(RT28xx_DIR)/sta/assoc.o\
	$(RT28xx_DIR)/sta/auth.o\
	$(RT28xx_DIR)/sta/auth_rsp.o\
	$(RT28xx_DIR)/sta/sync.o\
	$(RT28xx_DIR)/sta/sanity.o\
	$(RT28xx_DIR)/sta/rtmp_data.o\
	$(RT28xx_DIR)/sta/connect.o\
	$(RT28xx_DIR)/sta/wpa.o\
	$(RT28xx_DIR)/sta/sta_cfg.o

ifeq ($(OSABL),NO)
RT28XX_STA_OBJ += \
	$(RT28xx_DIR)/common/rt_os_util.o\
	$(RT28xx_DIR)/os/linux/sta_ioctl.o\
	$(RT28xx_DIR)/os/linux/rt_linux.o\
	$(RT28xx_DIR)/os/linux/rt_main_dev.o
else
RT28XX_STA_OBJ += \
	$(RT28xx_DIR)/os/linux/rt_symb.o
endif

ifeq ($(HAS_NEW_RATE_ADAPT_SUPPORT),y)
RT28XX_STA_OBJS += $(RT28xx_DIR)/rate_ctrl/alg_grp.o
endif

ifeq ($(HAS_ATE),y)
RT28XX_STA_OBJ += \
	$(RT28xx_DIR)/ate/common/rt_ate.o
endif

ifeq ($(HAS_QA_SUPPORT),y)
RT28XX_STA_OBJ += \
	$(RT28xx_DIR)/ate/common/rt_qa.o
endif

#ifdef DOT11_N_SUPPORT
ifeq ($(HAS_DOT11_N_SUPPORT),y)
RT28XX_STA_OBJ += \
	$(RT28xx_DIR)/common/ba_action.o\
	$(RT28xx_DIR)/mgmt/mgmt_ht.o

#ifdef TXBF_SUPPORT
ifeq ($(HAS_TXBF_SUPPORT),y)
rt$(MODULE)sta-objs += \
	$(RT28xx_DIR)/common/cmm_txbf.o\
	$(RT28xx_DIR)/common/cmm_txbf_cal.o
endif
#endif // TXBF_SUPPORT //
endif
#endif // DOT11_N_SUPPORT //

#ifdef ETH_CONVERT
ifeq ($(HAS_ETH_CONVERT_SUPPORT), y)
RT28XX_STA_OBJ += \
	$(RT28xx_DIR)/common/cmm_mat.o \
	$(RT28xx_DIR)/common/cmm_mat_iparp.o \
	$(RT28xx_DIR)/common/cmm_mat_pppoe.o \
	$(RT28xx_DIR)/common/cmm_mat_ipv6.o
endif
#endif // ETH_CONVERT //

#ifdef ADHOC_WPA2PSK_SUPPORT
RT28XX_STA_OBJ += \
	$(RT28xx_DIR)/common/cmm_wpa_adhoc.o
#endif // ADHOC_WPA2PSK_SUPPORT //

#ifdef WSC_INCLUDED
ifeq ($(HAS_WSC),y)
RT28XX_STA_OBJ += \
	$(RT28xx_DIR)/common/wsc.o\
	$(RT28xx_DIR)/common/wsc_tlv.o\
	$(RT28xx_DIR)/common/crypt_biginteger.o\
	$(RT28xx_DIR)/common/crypt_dh.o
endif
ifeq ($(HAS_WSC_V2),y)
RT28XX_STA_OBJ += $(RT28xx_DIR)/common/wsc_v2.o

ifeq ($(HAS_IWSC_SUPPORT),y)
RT28XX_STA_OBJ += $(RT28xx_DIR)/sta/sta_iwsc.o
endif

endif
#endif // WSC_INCLUDED //


ifeq ($(HAS_BLOCK_NET_IF),y)
RT28XX_STA_OBJ += $(RT28xx_DIR)/common/netif_block.o
endif

ifeq ($(HAS_QOS_DLS_SUPPORT),y)
RT28XX_STA_OBJ += $(RT28xx_DIR)/sta/dls.o
endif

#ifdef DOT11Z_TDLS_SUPPORT
ifeq ($(HAS_DOT11Z_TDLS_SUPPORT),y)
RT28XX_STA_OBJ += \
	$(RT28xx_DIR)/sta/tdls.o\
	$(RT28xx_DIR)/sta/tdls_ctrl.o\
	$(RT28xx_DIR)/sta/tdls_tlv.o\
	$(RT28xx_DIR)/sta/tdls_link_mng.o
endif
#endif // DOT11Z_TDLS_SUPPORT //

#ifdef LED_CONTROL_SUPPORT
ifeq ($(HAS_LED_CONTROL_SUPPORT),y)
RT28XX_STA_OBJ += \
	$(RT28xx_DIR)/common/rt_led.o
endif
#endif // LED_CONTROL_SUPPORT //







ifneq ($(findstring 3593,$(CHIPSET)),)
RT28XX_STA_OBJ += \
	$(RT28xx_DIR)/common/cmm_mac_pci.o\
	$(RT28xx_DIR)/common/cmm_data_pci.o\
	$(RT28xx_DIR)/os/linux/rt_rbus_pci_drv.o\
	$(RT28xx_DIR)/common/rtmp_mcu.o\
	$(RT28xx_DIR)/common/ee_prom.o\
	$(RT28xx_DIR)/common/ee_efuse.o\
	$(RT28xx_DIR)/common/rt_rf.o\
	$(RT28xx_DIR)/common/frq_cal.o\
	$(RT28xx_DIR)/chips/rt30xx.o\
	$(RT28xx_DIR)/chips/rt35xx.o\
	$(RT28xx_DIR)/chips/rt28xx.o\
	$(RT28xx_DIR)/chips/rt3593.o

ifeq ($(HAS_ATE),y)
RT28XX_STA_OBJ += \
	$(RT28xx_DIR)/ate/chips/rt3593_ate.o\
	$(RT28xx_DIR)/ate/common/ate_pci.o
endif

ifeq ($(OSABL),NO)
RT28XX_STA_OBJ += \
	$(RT28xx_DIR)/os/linux/rt_pci_rbus.o\
	$(RT28xx_DIR)/os/linux/rt_rbus_pci_util.o\
	$(RT28xx_DIR)/os/linux/pci_main_dev.o
endif
endif

ifneq ($(findstring 7601U,$(CHIPSET)),)
RT28XX_STA_OBJ += \
	$(RT28xx_DIR)/common/cmm_mac_usb.o\
	$(RT28xx_DIR)/common/cmm_data_usb.o\
	$(RT28xx_DIR)/common/rtusb_io.o\
	$(RT28xx_DIR)/common/rtusb_data.o\
	$(RT28xx_DIR)/common/rtusb_bulk.o\
	$(RT28xx_DIR)/os/linux/rt_usb.o\
	$(RT28xx_DIR)/common/ee_prom.o\
	$(RT28xx_DIR)/common/ee_efuse.o\
	$(RT28xx_DIR)/mcu/rtmp_and.o\
	$(RT28xx_DIR)/mcu/rtmp_mcu.o\
	$(RT28xx_DIR)/mcu/rtmp_M51.o\
	$(RT28xx_DIR)/common/rt_rf.o\
	$(RT28xx_DIR)/chips/mt7601.o\
	$(RT28xx_DIR)/mac/ral_omac.o

ifeq ($(HAS_RTMP_FLASH_SUPPORT),y)
RT28XX_STA_OBJ += \
	$(RT28xx_DIR)/common/ee_flash.o
endif
                                                                                
ifeq ($(HAS_ATE),y)
RT28XX_STA_OBJ += \
	$(RT28xx_DIR)/ate/chips/mt7601_ate.o\
	$(RT28xx_DIR)/ate/common/ate_usb.o
endif
                                                                                
ifeq ($(HAS_TSO_SUPPORT),y)
RT28XX_STA_OBJ += \
	$(RT28xx_DIR)/naf/net_acc.o\
	$(RT28xx_DIR)/naf/tso.o\
	$(RT28xx_DIR)/naf/cso.o
endif

ifeq ($(OSABL),NO)
RT28XX_STA_OBJ += \
	$(RT28xx_DIR)/os/linux/rt_usb.o\
	$(RT28xx_DIR)/os/linux/rt_usb_util.o\
	$(RT28xx_DIR)/os/linux/usb_main_dev.o\
	$(RT28xx_DIR)/common/rtusb_dev_id.o
endif
                                                                                
ifneq ($(findstring $(RT28xx_MODE),STA APSTA),)
RT28XX_STA_OBJ += \
	$(RT28xx_DIR)/common/frq_cal.o
endif


endif



ifneq ($(findstring 3390,$(CHIPSET)),)
RT28XX_STA_OBJ += \
	$(RT28xx_DIR)/common/cmm_mac_pci.o\
	$(RT28xx_DIR)/common/cmm_data_pci.o\
	$(RT28xx_DIR)/os/linux/rt_rbus_pci_drv.o\
	$(RT28xx_DIR)/common/ee_prom.o\
	$(RT28xx_DIR)/common/ee_efuse.o\
	$(RT28xx_DIR)/common/rtmp_mcu.o\
	$(RT28xx_DIR)/common/rt_rf.o\
	$(RT28xx_DIR)/chips/rt30xx.o\
	$(RT28xx_DIR)/chips/rt3090.o\
	$(RT28xx_DIR)/chips/rt33xx.o\
	$(RT28xx_DIR)/chips/rt3390.o

ifeq ($(HAS_ATE),y)
RT28XX_STA_OBJ += \
	$(RT28xx_DIR)/ate/chips/rt33xx_ate.o\
	$(RT28xx_DIR)/ate/chips/rt30xx_ate.o\
	$(RT28xx_DIR)/ate/common/ate_pci.o
endif

ifeq ($(OSABL),NO)
RT28XX_STA_OBJ += \
	$(RT28xx_DIR)/os/linux/rt_pci_rbus.o\
	$(RT28xx_DIR)/os/linux/rt_rbus_pci_util.o\
	$(RT28xx_DIR)/os/linux/pci_main_dev.o
endif
endif








#ifdef WAPI_SUPPORT
ifeq ($(HAS_WAPI_SUPPORT),y)
RT28XX_STA_OBJ += \
	$(RT28xx_DIR)/common/wapi.o
endif
#endif // WAPI_SUPPORT //



#ifdef P2P_SUPPORT
ifeq ($(OSABL),NO)
ifeq ($(HAS_P2P_SUPPORT),y)
RT28XX_STA_OBJ += \
        $(RT28xx_DIR)/common/p2p_inf.o
endif
endif

ifeq ($(HAS_P2P_SUPPORT),y)
RT28XX_STA_OBJ += \
	$(RT28xx_DIR)/ap/ap_mbss.o\
	$(RT28xx_DIR)/ap/ap.o\
	$(RT28xx_DIR)/ap/ap_assoc.o\
	$(RT28xx_DIR)/ap/ap_auth.o\
	$(RT28xx_DIR)/ap/ap_connect.o\
	$(RT28xx_DIR)/ap/ap_mlme.o\
	$(RT28xx_DIR)/ap/ap_sanity.o\
	$(RT28xx_DIR)/ap/ap_sync.o\
	$(RT28xx_DIR)/ap/ap_wpa.o\
	$(RT28xx_DIR)/ap/ap_data.o\
	$(RT28xx_DIR)/common/uapsd.o\
	$(RT28xx_DIR)/ap/ap_autoChSel.o\
	$(RT28xx_DIR)/ap/ap_qload.o\
	$(RT28xx_DIR)/sta/p2pcli.o \
	$(RT28xx_DIR)/sta/p2pcli_ctrl.o \
	$(RT28xx_DIR)/sta/p2pcli_sync.o \
	$(RT28xx_DIR)/sta/p2pcli_auth.o \
	$(RT28xx_DIR)/sta/p2pcli_assoc.o \
	$(RT28xx_DIR)/common/cmm_mat.o \
	$(RT28xx_DIR)/common/cmm_mat_iparp.o \
	$(RT28xx_DIR)/common/cmm_mat_pppoe.o \
	$(RT28xx_DIR)/common/cmm_mat_ipv6.o \
	$(RT28xx_DIR)/common/p2p_dbg.o\
	$(RT28xx_DIR)/common/p2p.o\
	$(RT28xx_DIR)/common/p2p_packet.o\
	$(RT28xx_DIR)/common/p2p_action.o\
	$(RT28xx_DIR)/common/p2p_table.o\
	$(RT28xx_DIR)/common/p2p_ctrl.o\
	$(RT28xx_DIR)/common/p2p_disc_mng.o\
	$(RT28xx_DIR)/common/p2p_nego_mng.o\
	$(RT28xx_DIR)/common/p2p_dbg.o\
	$(RT28xx_DIR)/common/p2p.o\
	$(RT28xx_DIR)/common/p2p_packet.o\
	$(RT28xx_DIR)/common/p2p_action.o\
	$(RT28xx_DIR)/common/p2p_table.o\
	$(RT28xx_DIR)/common/p2p_ctrl.o\
	$(RT28xx_DIR)/common/p2p_disc_mng.o\
	$(RT28xx_DIR)/common/p2p_nego_mng.o\
	$(RT28xx_DIR)/common/p2p_cfg.o\
	$(RT28xx_DIR)/common/wsc.o\
	$(RT28xx_DIR)/common/wsc_tlv.o\
	$(RT28xx_DIR)/common/wsc_ufd.o\
	$(RT28xx_DIR)/common/crypt_biginteger.o\
	$(RT28xx_DIR)/common/crypt_dh.o	

ifeq ($(HAS_QOS_DLS_SUPPORT),y)
RT28XX_STA_OBJ += $(RT28xx_DIR)/ap/ap_dls.o
endif

endif

ifeq ($(HAS_P2P_SUPPORT),y)
ifeq ($(OSABL),NO)
RT28XX_STA_OBJ += \
        $(RT28xx_DIR)/ap/ap_mbss_inf.o\
        $(RT28xx_DIR)/common/rt_os_util.o\
        $(RT28xx_DIR)/os/linux/ap_ioctl.o\
        $(RT28xx_DIR)/os/linux/sta_ioctl.o\
        $(RT28xx_DIR)/os/linux/rt_linux.o\
        $(RT28xx_DIR)/os/linux/rt_main_dev.o
else
rt$(MODULE)sta-objs += \
        ../../os/linux/rt_symb.o
endif
endif
#endif // P2P_SUPPORT //

#endif // CONFIG_STA_SUPPORT //

#ifdef CONFIG_APSTA_SUPPORT
RT28XX_APSTA_OBJ := \
	$(RT28xx_DIR)/common/crypt_md5.o\
	$(RT28xx_DIR)/common/crypt_sha2.o\
	$(RT28xx_DIR)/common/crypt_hmac.o\
	$(RT28xx_DIR)/common/crypt_aes.o\
	$(RT28xx_DIR)/common/crypt_arc4.o\
	$(RT28xx_DIR)/common/mlme.o\
	$(RT28xx_DIR)/common/cmm_wep.o\
	$(RT28xx_DIR)/common/action.o\
	$(RT28xx_DIR)/common/cmm_data.o\
	$(RT28xx_DIR)/common/rtmp_init.o\
	$(RT28xx_DIR)/common/cmm_tkip.o\
	$(RT28xx_DIR)/common/cmm_aes.o\
	$(RT28xx_DIR)/common/cmm_sync.o\
	$(RT28xx_DIR)/common/eeprom.o\
	$(RT28xx_DIR)/common/cmm_sanity.o\
	$(RT28xx_DIR)/common/cmm_info.o\
	$(RT28xx_DIR)/common/cmm_cfg.o\
	$(RT28xx_DIR)/common/cmm_wpa.o\
	$(RT28xx_DIR)/common/cmm_wpa_adhoc.o\
	$(RT28xx_DIR)/common/dfs.o\
	$(RT28xx_DIR)/common/spectrum.o\
	$(RT28xx_DIR)/common/rtmp_timer.o\
	$(RT28xx_DIR)/common/rt_channel.o\
	$(RT28xx_DIR)/common/cmm_profile.o\
	$(RT28xx_DIR)/common/cmm_asic.o\
	$(RT28xx_DIR)/common/cmm_cmd.o\
	$(RT28xx_DIR)/rate_ctrl/ra_ctrl.o\
	$(RT28xx_DIR)/rate_ctrl/alg_legacy.o\
	$(RT28xx_DIR)/ap/ap.o\
	$(RT28xx_DIR)/ap/ap_assoc.o\
	$(RT28xx_DIR)/ap/ap_auth.o\
	$(RT28xx_DIR)/ap/ap_connect.o\
	$(RT28xx_DIR)/ap/ap_mlme.o\
	$(RT28xx_DIR)/ap/ap_sanity.o\
	$(RT28xx_DIR)/ap/ap_sync.o\
	$(RT28xx_DIR)/ap/ap_wpa.o\
	$(RT28xx_DIR)/ap/ap_data.o\
	$(RT28xx_DIR)/common/uapsd.o\
	$(RT28xx_DIR)/sta/assoc.o\
	$(RT28xx_DIR)/sta/auth.o\
	$(RT28xx_DIR)/sta/auth_rsp.o\
	$(RT28xx_DIR)/sta/sync.o\
	$(RT28xx_DIR)/sta/sanity.o\
	$(RT28xx_DIR)/sta/rtmp_data.o\
	$(RT28xx_DIR)/sta/connect.o\
	$(RT28xx_DIR)/sta/wpa.o\
	$(RT28xx_DIR)/sta/sta_cfg.o\
	$(RT28xx_DIR)/ap/ap_autoChSel.o\
	$(RT28xx_DIR)/ap/ap_qload.o\
	$(RT28xx_DIR)/ap/ap_cfg.o

ifeq ($(OSABL),NO)
RT28XX_APSTA_OBJ += \
	$(RT28xx_DIR)/common/rtmp_init_inf.o\
	$(RT28xx_DIR)/ap/ap_mbss.o\
	$(RT28xx_DIR)/os/linux/rt_profile.o\
	$(RT28xx_DIR)/os/linux/ap_ioctl.o\
	$(RT28xx_DIR)/os/linux/sta_ioctl.o\
	$(RT28xx_DIR)/os/linux/rt_linux.o\
	$(RT28xx_DIR)/os/linux/rt_main_dev.o
endif

ifeq ($(HAS_NEW_RATE_ADAPT_SUPPORT),y)
RT28XX_APSTA_OBJS += $(RT28xx_DIR)/rate_ctrl/alg_grp.o
endif

#ifdef DOT11_N_SUPPORT
ifeq ($(HAS_DOT11_N_SUPPORT),y)
RT28XX_APSTA_OBJ += \
	$(RT28xx_DIR)/common/ba_action.o

#ifdef TXBF_SUPPORT
ifeq ($(HAS_TXBF_SUPPORT),y)
rt$(MODULE)apsta-objs += \
	$(RT28xx_DIR)/common/cmm_txbf.o\
	$(RT28xx_DIR)/common/cmm_txbf_cal.o
endif
#endif // TXBF_SUPPORT //
endif
#endif // DOT11_N_SUPPORT //


#ifdef LED_CONTROL_SUPPORT
ifeq ($(HAS_LED_CONTROL_SUPPORT),y)
RT28XX_APSTA_OBJ += \
	$(RT28xx_DIR)/common/rt_led.o
endif
#endif // LED_CONTROL_SUPPORT //








ifneq ($(findstring 3573,$(CHIPSET)),)
RT28XX_APSTA_OBJ += \
	$(RT28xx_DIR)/common/cmm_mac_usb.o\
	$(RT28xx_DIR)/common/rtusb_io.o\
	$(RT28xx_DIR)/common/rtusb_data.o\
	$(RT28xx_DIR)/common/cmm_data_usb.o\
	$(RT28xx_DIR)/common/rtmp_mcu.o\
	$(RT28xx_DIR)/common/ee_prom.o\
	$(RT28xx_DIR)/common/ee_efuse.o\
	$(RT28xx_DIR)/common/rt_rf.o\
	$(RT28xx_DIR)/common/rtusb_bulk.o\
	$(RT28xx_DIR)/common/frq_cal.o\
	$(RT28xx_DIR)/os/linux/rt_usb.o\
	$(RT28xx_DIR)/chips/rt28xx.o\
	$(RT28xx_DIR)/chips/rt30xx.o\
	$(RT28xx_DIR)/chips/rt35xx.o\
	$(RT28xx_DIR)/chips/rt3593.o

ifeq ($(OSABL),NO)
RT28XX_APSTA_OBJ += \
	$(RT28xx_DIR)/common/rtusb_dev_id.o\
	$(RT28xx_DIR)/os/linux/rt_usb_util.o\
	$(RT28xx_DIR)/os/linux/usb_main_dev.o
endif
ifeq ($(HAS_DFS_SUPPORT),y)
RT28XX_APSTA_OBJ += \
	$(RT28xx_DIR)/common/dfs_mcu.o
endif
endif

ifneq ($(findstring 3593,$(CHIPSET)),)
RT28XX_APSTA_OBJ += \
	$(RT28xx_DIR)/common/cmm_mac_pci.o\
	$(RT28xx_DIR)/common/cmm_data_pci.o\
	$(RT28xx_DIR)/os/linux/rt_rbus_pci_drv.o\
	$(RT28xx_DIR)/common/rtmp_mcu.o\
	$(RT28xx_DIR)/common/ee_prom.o\
	$(RT28xx_DIR)/common/ee_efuse.o\
	$(RT28xx_DIR)/common/rt_rf.o\
	$(RT28xx_DIR)/common/frq_cal.o\
	$(RT28xx_DIR)/chips/rt30xx.o\
	$(RT28xx_DIR)/chips/rt35xx.o\
	$(RT28xx_DIR)/chips/rt28xx.o\
	$(RT28xx_DIR)/chips/rt3593.o

ifeq ($(OSABL),NO)
RT28XX_APSTA_OBJ += \
	$(RT28xx_DIR)/os/linux/rt_pci_rbus.o\
	$(RT28xx_DIR)/os/linux/rt_rbus_pci_util.o\
	$(RT28xx_DIR)/os/linux/pci_main_dev.o
endif
ifeq ($(HAS_DFS_SUPPORT),y)
RT28XX_APSTA_OBJ += \
	$(RT28xx_DIR)/common/dfs_mcu.o
endif
endif





#ifdef WSC_INCLUDED
ifeq ($(HAS_WSC),y)
RT28XX_APSTA_OBJ += \
	$(RT28xx_DIR)/common/wsc.o\
	$(RT28xx_DIR)/common/wsc_tlv.o\
	$(RT28xx_DIR)/common/crypt_biginteger.o\
	$(RT28xx_DIR)/common/crypt_dh.o
endif
#endif // WSC_INCLUDED //


ifeq ($(HAS_WDS),y)
RT28XX_APSTA_OBJ += $(RT28xx_DIR)/ap/ap_wds.o

ifeq ($(OSABL),NO)
RT28XX_APSTA_OBJ += \
	../../ap/ap_wds_inf.o
endif
endif

ifeq ($(HAS_QOS_DLS_SUPPORT),y)
RT28XX_APSTA_OBJ += $(RT28xx_DIR)/ap/ap_dls.o
endif

ifeq ($(HAS_IDS_SUPPORT),y)
RT28XX_APSTA_OBJ += $(RT28xx_DIR)/ap/ap_ids.o
endif

#ifdef APCLI_SUPPORT
ifeq ($(HAS_APCLI),y)
RT28XX_APSTA_OBJ += \
	$(RT28xx_DIR)/ap/ap_apcli.o \
	$(RT28xx_DIR)/ap/apcli_ctrl.o \
	$(RT28xx_DIR)/ap/apcli_sync.o \
	$(RT28xx_DIR)/ap/apcli_auth.o \
	$(RT28xx_DIR)/ap/apcli_assoc.o \
	$(RT28xx_DIR)/common/cmm_mat.o \
	$(RT28xx_DIR)/common/cmm_mat_iparp.o \
	$(RT28xx_DIR)/common/cmm_mat_pppoe.o \
	$(RT28xx_DIR)/common/cmm_mat_ipv6.o

ifeq ($(OSABL),NO)
RT28XX_APSTA_OBJ += \
	../../ap/ap_apcli_inf.o
endif
endif
#endif // APCLI_SUPPORT //

#ifdef ETH_CONVERT
ifeq ($(HAS_ETH_CONVERT_SUPPORT), y)
RT28XX_APSTA_OBJ += \
	$(RT28xx_DIR)/common/cmm_mat.o \
	$(RT28xx_DIR)/common/cmm_mat_iparp.o \
	$(RT28xx_DIR)/common/cmm_mat_pppoe.o \
	$(RT28xx_DIR)/common/cmm_mat_ipv6.o
endif
#endif // ETH_CONVERT //

ifeq ($(HAS_BLOCK_NET_IF),y)
RT28XX_APSTA_OBJ += $(RT28xx_DIR)/common/netif_block.o
endif

ifeq ($(HAS_IGMP_SNOOP_SUPPORT),y)
RT28XX_APSTA_OBJ += $(RT28xx_DIR)/common/igmp_snoop.o
endif


#ifdef WAPI_SUPPORT
ifeq ($(HAS_WAPI_SUPPORT),y)
RT28XX_APSTA_OBJ += \
	$(RT28xx_DIR)/common/wapi.o
endif
#endif // WAPI_SUPPORT //


ifeq ($(HAS_CLIENT_WDS_SUPPORT),y)
RT28XX_APSTA_OBJ += \
	$(RT28xx_DIR)/common/client_wds.o
endif
#endif // CONFIG_APSTA_SUPPORT //

PHONY := all release clean install uninstall

all:$(OBJ)

mt$(MODULE)sta.o: $(RT28XX_STA_OBJ)
	$(LD) -r $^ -o $@

mt$(MODULE)ap.o: $(RT28XX_AP_OBJ)
	$(LD) -r $^ -o $@

mt$(MODULE)apsta.o: $(RT28XX_APSTA_OBJ)
	$(LD) -r $^ -o $@

release:
	echo "MAKE Linux Station Code Release"

clean:
	rm -f $(RT28xx_DIR)/common/*.o
	rm -f $(RT28xx_DIR)/common/.*.{cmd,flags,d}
	rm -f $(RT28xx_DIR)/os/linux/*.{o,ko,mod.{o,c}}
	rm -f $(RT28xx_DIR)/os/linux/.*.{cmd,flags,d}
	rm -fr $(RT28xx_DIR)/os/linux/.tmp_versions
	rm -f $(RT28xx_DIR)/chips/*.o
	rm -f $(RT28xx_DIR)/chips/.*.{cmd,flags,d}
ifeq ($(RT28xx_MODE),AP)
	rm -f $(RT28xx_DIR)/ap/*.o
	rm -f $(RT28xx_DIR)/ap/.*.{cmd,flags,d}
else
ifeq ($(RT28xx_MODE),STA)
	rm -f $(RT28xx_DIR)/sta/*.o
	rm -f $(RT28xx_DIR)/sta/.*.{cmd,flags,d}
else
ifeq ($(RT28xx_MODE),APSTA)
	rm -f $(RT28xx_DIR)/ap/*.o
	rm -f $(RT28xx_DIR)/ap/.*.{cmd,flags,d}
	rm -f $(RT28xx_DIR)/sta/*.o
	rm -f $(RT28xx_DIR)/sta/.*.{cmd,flags,d}
endif
endif
endif

install:
	mkdir -pv $(DAT_PATH)
	cp -v $(RT28xx_DIR)/../etc/Wireless/RT2870AP/$(DAT_FILE_NAME) $(DAT_PATH)/.
	install -d $(LINUX_SRC_MODULE)
	install -m 644 -c $(addsuffix .o,$(MOD_NAME)) $(LINUX_SRC_MODULE)
	/sbin/depmod -a ${shell uname -r}

uninstall:
	rm -rvf $(DAT_PATH)
	rm -rvf $(addprefix $(LINUX_SRC_MODULE),$(addsuffix .o,$(MOD_NAME)))
	/sbin/depmod -a ${shell uname -r}

# Declare the contents of the .PHONY variable as phony.  We keep that
# information in a variable so we can use it in if_changed and friends.
.PHONY: $(PHONY)

